#define _CRT_SECURE_NO_WARNINGS
using namespace std;
#include "Student.h"
#include "Person.h"
#include"Child.h"
#include"HighStudent.h"

int main() {
    HighStudent stu("jake", 15);
    stu.Student::print();
    stu.Child::print();
    cout << "==============================="<<endl;
    cout << stu.S << endl;//如果Person不是stu的直接父类，
                          //是不能访问父类的父类的数据成员的
    cout << "===============================" << endl;
    //在student类中重写一下Work函数(静态多态)
    stu.Person::work();
    stu.work();
    cout << "===============================" << endl;
    //直接实现 Work 函数的动态多态
    //使用方法：基类类型 变量名 = new 派生类对象(参数列表);
    Person* stu1 = new Person("MIKE");
    stu1->work();
    Person* stu2 = new Student("mike",22);
    stu2->work();
    delete stu1;
    stu1 = NULL;
    delete stu2;
    stu2 = NULL;
    cout << "===============================" << endl;

    return 0;
}